//
//  ExampleSection.swift
//  SwiftUIFly
//
//  Created by shen on 2023/10/18.
//

import SwiftUI

struct ExampleSection<Content: View>: View {
    var title: String?
    var description: String
    let content: () -> Content

    var body: some View {
        Group {
            #if os(iOS)
            Section(footer: Text(description)) {
                if let title = title {
                    Text(title)
                        .font(.headline)
                }
                content()
            }
            #else
            Group {
                if let title = title {
                    Text(title).font(.title3).bold()
                }
                content()
                Text(description).font(.body).foregroundColor(.secondary)
                Divider()
            }
            #endif
        }
    }
}
